// Copyright (C) 2018 Toitware ApS.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; version
// 2.1 only.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// The license can be found in the file `LICENSE` in the top level
// directory of this repository.

#pragma once

#include "symbol.h"

namespace toit {
namespace compiler {

class PrimitiveResolver {
 public:
  static int find_module(Symbol name);
  static int find_primitive(Symbol name, int module);

  // Get the arity for the given primitive.
  static int arity(int primitive, int module);

  // For generating debugging information related to primitive tables.
  static int number_of_modules();
  static const char* module_name(int index);
  static int number_of_primitives(int module);
  static const char* primitive_name(int module, int index);
};

}  // namespace compiler
}  // namespace toit
